<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
</head>
<body>
<form action="./login.do" method="get">
    用户名：<input type="text" id="username" name="username" value=""/><br/>
    密码:<input type="password" name="password"/><br/>
    <button type="submit">登录</button>
</form>
<script type="text/javascript">
    window.onload = function () {
        var cookiesStr = document.cookie;
        var cookieArr = cookiesStr.split("; ");
        for (var i = 0; i < cookieArr.length; i++) {
            var cookieStr = cookieArr[i];
            //根据 '=' 分隔
            var strings = cookieStr.split('=');
            if (strings[0] == 'username'){
                document.getElementById('username').value = strings[1];
                break;
            }
        }
    }
</script>
</body>
</html>